<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="header.jsp"%>
   
<% String title = "全安药业信息综合系统后台登陆"; %>
<title><%=title %></title>
</head>

<!-- BEGIN BODY -->
<body class="lock" onkeydown="keyDown()">
	<!-- ui-dialog -->
	<div id="dialog2" title="Dialog Title" class="ui-dialog-content ui-widget-content">
		<p>点击Open Dialog，显示的内容</p>
	</div>

	<form id="login">
		<div class="lock-header">
			<!-- BEGIN LOGO -->
			<a class="center" id="logo" href="#"> 
			<img class="center" alt="logo" src="img/logo.png">
			</a>
			<!-- END LOGO -->
		</div>
		<div class="login-wrap">
			<div class="metro single-size red">
				<div class="locked">
					<i class="icon-lock"></i> <span>登录</span>
				</div>
			</div>
			<div class="metro double-size green">
				<div class="input-append lock-input">
					<input type="text" class="" placeholder="请输入用户名" name="username">
				</div>
			</div>
			<div class="metro double-size yellow">
				<div class="input-append lock-input">
					<input type="password" class="" placeholder="请输入用户密码" name="password">
				</div>
			</div>
			<div class="metro single-size purple">
				<a href="#" class="social-link"  onclick="login()"> <i class="icon-skype"></i>
					<span>登 录</span>
				</a>
			</div>
			<div class="login-footer">
				<div class="remember-hint pull-left">
					<input type="checkbox" id=""> 记住密码
				</div>
				<div class="forgot-hint pull-right">
					<a id="forget-password" class="" href="javascript:;">忘记密码?</a>
				</div>
			</div>
		</div>
	</form>
	
	
	<script src="js/jquery-1.8.3.min.js"></script>
	<script src="javascript/httpService.js"></script>
	<!-- jQuery-UI插件相关js的引入 -->
	<script src="jquery-ui-1.12.1/external/jquery/jquery.js"></script>
	<script src="jquery-ui-1.12.1/jquery-ui.js"></script>
	<!-- 自定义的script方法 -->
	<script type="text/javascript">
		//回车登陆
		function keyDown() {
			//如果键盘按了回车
			if (event.keyCode == 13) {
				var params = $("#login").serialize();
				sendRequest(pageContextPath + "/user/toLogin.do", params,
					function(responseJson) {
						if (responseJson.data.message != null) {
							$("#dialog2").html("");
							var html = '<p>'+responseJson.data.message+'</p>';
							$("#dialog2").html(html);
							$("#dialog2").attr("class","ui-dialog-content ui-widget-content");
							$( "#dialog2" ).dialog( "open" );
						} else {
							//登陆成功则，加载用户权限跳转到首页。
							window.location.href = "index.jsp";
						}
				});
			}
		}
		//点击登录
		function login() {
			var params = $("#login").serialize();
			sendRequest(pageContextPath + "/user/toLogin.do", params,
				function(responseJson) {
					if (responseJson.data.message != null) {
						$("#dialog2").html("");
						var html = '<p>'+responseJson.data.message+'</p>';
						$("#dialog2").html(html);
						$("#dialog2").attr("class","ui-dialog-content ui-widget-content");
						$( "#dialog2" ).dialog( "open" );
					} else {
						//登陆成功则，加载用户权限跳转到首页。
						window.location.href = "index.jsp";
					}
			});
		}
		
		//提示对话框
		$( "#dialog2" ).dialog({
			autoOpen: false,
			width: 400,
			title:'<%=title%>',
			buttons: [
				{
					text: "知道了",
					click: function() {
						$( this ).dialog( "close" );
					}
				}
			]
		});
	</script>
	<!-- END BODY -->
</body>
</html>